﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;

namespace StudentManagement.Models
{
    public class Student : BaseEntity
    {
        [Required(ErrorMessage = "姓名不能为空！")]
        public string Name { get; set; }

        public string Major { get; set; }

        [Display(Name = "电子邮箱")]
        [RegularExpression(@"^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$", ErrorMessage = "邮箱格式不正确")]
        [Required(ErrorMessage = "邮箱地址不能为空!")]
        public string Email { get; set; }

        [Display(Name = "入学日期")]
        [DataType(DataType.Date)]
        [DisplayFormat(DataFormatString = "{0:yyyy-MM-dd}", ApplyFormatInEditMode = true)]
        public DateTime EnrollmentDate { get; set; }
        public ICollection<StudentCourse> StudentCourses { get; set; }
    }
}
